package test;

import cn.jc.springframework.context.support.ClassPathXmlApplicationContext;
import org.junit.Test;
import test.bean.UserService;

/**
 * @Description:
 * @author: JC
 * @date: 2023/4/7 14:29
 */
public class ApiTest8 {

    @Test
    public void test(){
        // 1.初始化 BeanFactory
        ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:spring.xml");
        applicationContext.registerShutdownHook();
        // 2. 获取 Bean 对象调用方法
        UserService userService = applicationContext.getBean("userService", UserService.class);
        String result = userService.queryUserInfo();
        System.out.println("测试结果：" + result);
    }
}
